How can I return just the first line of the Object Text? |
Re: How can I return just the first line of the Object Text?
Well, what do you mean by a line? The first line visible in DOORS main column or the first line ending in a return (paragraph)? string ObjectText = o."Object Text"
you get the plain text content. If you want to have the rich text, you have to use
string ObjectText = richText(o."Object Text")
string ObjectText = richTextWithOle(o."Object Text")
|
Re: How can I return just the first line of the Object Text?
Object o = current()
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(o."Object Text")
RichTextParagraph EachRichTextParagraph
for EachRichTextParagraph in (tempStringOf(aRichTextBuffer)) do
{
print(EachRichTextParagraph.text)
break
}
delete(aRichTextBuffer )
}
|
Re: How can I return just the first line of the Object Text? SystemAdmin - Fri Oct 19 05:22:33 EDT 2012
Well, what do you mean by a line? The first line visible in DOORS main column or the first line ending in a return (paragraph)? string ObjectText = o."Object Text"
you get the plain text content. If you want to have the rich text, you have to use
string ObjectText = richText(o."Object Text")
string ObjectText = richTextWithOle(o."Object Text")
I want to return the first line ending in a return. I guess I want RTF, because I want underlining and bold to be included. The script is based on what the analysis wizard generated - I'm not able to write scripts from scratch.
OT = probeRichAttr_(othero,"Object Text", false)
if (findPlainText (OT, "\n", offset, length, matchCase, reverse)) {
displayRich("\\pard " "Traced From: " OT[0:offset])
}
|
Re: How can I return just the first line of the Object Text? SystemAdmin - Fri Oct 19 07:15:01 EDT 2012
Object o = current()
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(o."Object Text")
RichTextParagraph EachRichTextParagraph
for EachRichTextParagraph in (tempStringOf(aRichTextBuffer)) do
{
print(EachRichTextParagraph.text)
break
}
delete(aRichTextBuffer )
}
I tried pasting your script into position in my wizard-generated script, but it gave me some syntax errors, and I don't know how to fix them. |
Re: How can I return just the first line of the Object Text? SystemAdmin - Fri Oct 19 14:48:30 EDT 2012 |
Re: How can I return just the first line of the Object Text? SystemAdmin - Mon Oct 22 02:46:44 EDT 2012
Now the code shows no errors afgter I click "Check". But now the code returns nothing. Here's the chunk in question.
MODULE = name(otherMod)
if (isBaseline(otherVersion)) {
MODULE = MODULE " [" versionString(otherVersion) "]"
}
displayRich("\\pard " MODULE)
IF_IDENTIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Object Identifier", false)
displayRich("\\pard ID: " IF_IDENTIFIER " (" IF_VnV_ED ")")
IF_NAME = probeRichAttr_(IF_PARENT_OBJECT,"Object Heading", false)
displayRich("\\pard " IF_NAME)
IF_SPECIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Responsible", false)
displayRich("\\pard " "Specifier: " IF_SPECIFIER)
s = probeRichAttr_(othero,"Object Text", false)
// if (findPlainText (s, ":", offset, length, matchCase, reverse)) {
// displayRich("\\pard " "Traced From: " s[0:offset])
// }
Object o = current()
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(o."Object Text")
RichTextParagraph EachRichTextParagraph
for EachRichTextParagraph in (tempStringOf(aRichTextBuffer)) do
{
print(EachRichTextParagraph.text)
break
}
delete(aRichTextBuffer )
IF_VERIFIER = probeRichAttr_(othero,"Responsible", false)
displayRich("\\pard " "Verifier: " IF_VERIFIER )
displayRich("\\pard " " ")
|
Re: How can I return just the first line of the Object Text? SystemAdmin - Mon Oct 22 14:24:19 EDT 2012
Now the code shows no errors afgter I click "Check". But now the code returns nothing. Here's the chunk in question.
MODULE = name(otherMod)
if (isBaseline(otherVersion)) {
MODULE = MODULE " [" versionString(otherVersion) "]"
}
displayRich("\\pard " MODULE)
IF_IDENTIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Object Identifier", false)
displayRich("\\pard ID: " IF_IDENTIFIER " (" IF_VnV_ED ")")
IF_NAME = probeRichAttr_(IF_PARENT_OBJECT,"Object Heading", false)
displayRich("\\pard " IF_NAME)
IF_SPECIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Responsible", false)
displayRich("\\pard " "Specifier: " IF_SPECIFIER)
s = probeRichAttr_(othero,"Object Text", false)
// if (findPlainText (s, ":", offset, length, matchCase, reverse)) {
// displayRich("\\pard " "Traced From: " s[0:offset])
// }
Object o = current()
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(o."Object Text")
RichTextParagraph EachRichTextParagraph
for EachRichTextParagraph in (tempStringOf(aRichTextBuffer)) do
{
print(EachRichTextParagraph.text)
break
}
delete(aRichTextBuffer )
IF_VERIFIER = probeRichAttr_(othero,"Responsible", false)
displayRich("\\pard " "Verifier: " IF_VERIFIER )
displayRich("\\pard " " ")
It is getting the first paragraph of the 'current' object. That means the object that is selected in the GUI. Object o = current()
aRichTextBuffer = richTextWithOle(o."Object Text")
aRichTextBuffer = richTextNoOle(obj."Object Text")
print(EachRichTextParagraph.text)
display(EachRichTextParagraph.text)
display("Paragraph 1")
display("Paragraph 2")
display("Paragraph 3")
display("Paragraph 1\nParagraph 2\nParagraph 3")
|
Re: How can I return just the first line of the Object Text? SystemAdmin - Mon Oct 22 14:24:19 EDT 2012
Now the code shows no errors afgter I click "Check". But now the code returns nothing. Here's the chunk in question.
MODULE = name(otherMod)
if (isBaseline(otherVersion)) {
MODULE = MODULE " [" versionString(otherVersion) "]"
}
displayRich("\\pard " MODULE)
IF_IDENTIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Object Identifier", false)
displayRich("\\pard ID: " IF_IDENTIFIER " (" IF_VnV_ED ")")
IF_NAME = probeRichAttr_(IF_PARENT_OBJECT,"Object Heading", false)
displayRich("\\pard " IF_NAME)
IF_SPECIFIER = probeRichAttr_(IF_PARENT_OBJECT,"Responsible", false)
displayRich("\\pard " "Specifier: " IF_SPECIFIER)
s = probeRichAttr_(othero,"Object Text", false)
// if (findPlainText (s, ":", offset, length, matchCase, reverse)) {
// displayRich("\\pard " "Traced From: " s[0:offset])
// }
Object o = current()
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(o."Object Text")
RichTextParagraph EachRichTextParagraph
for EachRichTextParagraph in (tempStringOf(aRichTextBuffer)) do
{
print(EachRichTextParagraph.text)
break
}
delete(aRichTextBuffer )
IF_VERIFIER = probeRichAttr_(othero,"Responsible", false)
displayRich("\\pard " "Verifier: " IF_VERIFIER )
displayRich("\\pard " " ")
... and for richText use this:
Buffer aRichTextBuffer = create()
aRichTextBuffer = richTextWithOle(obj."Object Text")
Regexp aRegexp = regexp2("(.*?[^\\\\])(\\\\par[^d])")
if(aRegexp aRichTextBuffer) {
Buffer aSubBuffer = aRichTextBuffer[match 1]
displayRich((tempStringOf(aSubBuffer)) "}")
delete(aSubBuffer)
} else {
displayRich((tempStringOf(aRichTextBuffer)))
}
delete(aRegexp)
delete(aRichTextBuffer)
|
Re: How can I return just the first line of the Object Text? SystemAdmin - Tue Oct 23 03:58:09 EDT 2012
It is getting the first paragraph of the 'current' object. That means the object that is selected in the GUI. Object o = current()
aRichTextBuffer = richTextWithOle(o."Object Text")
aRichTextBuffer = richTextNoOle(obj."Object Text")
print(EachRichTextParagraph.text)
display(EachRichTextParagraph.text)
display("Paragraph 1")
display("Paragraph 2")
display("Paragraph 3")
display("Paragraph 1\nParagraph 2\nParagraph 3")
I don't understand the code, but it works. Can you recommend a good resource for learning DXL? The reference manual is no good for learning, only reference. Also, in your response, you mention Layout DXL. Does that mean your original code was for use in Attribute DXL? Thank you very much for your help, Matthew |
Re: How can I return just the first line of the Object Text? SystemAdmin - Tue Oct 23 17:38:47 EDT 2012 The original code was written for 'on demand' DXL. Paste it in the 'Tools - Edit DXL...' window of a module and click run. |